import csv
import time
import pymysql
import pytest
import requests


@pytest.fixture(params=[('admin','123456'),('boss','654321')])
def login(request):
    print('----------------login-----------------')
    r = request
    print(r.param)
    yield 'cookie'
    print('快饿死的xiny', time.time())


@pytest.fixture()
def login():
    # self.setup_db()
    login = requests.post("http://localhost:8080/woniusales/user/login",
                          {"username": "admin", "password": "admin123", "verifycode": "0000"})
    return login.cookies

def setup_db():
    cnn = pymysql.connect(host="localhost", port=3316, user="root", password="654321", charset="utf8",
                          database="woniusales")
    cur = cnn.cursor()
    cnn.begin()
    cur.execute("delete FROM customer where customerid>=15188")
    cnn.commit()
    cur.close()
    cnn.close()



